/*
 * @Descripttion: GGB
 * @version: 1.0
 * @Author: GGB
 * @Date: 2021-08-18 16:17:40
 * @LastEditors: GGB
 * @LastEditTime: 2021-08-18 16:40:15
 */
import 'package:flutter/material.dart';
import 'package:flutter_data_center/model/broadcast/broadcast_model.dart';
import 'package:flutter_data_center/utills/color_utils.dart';
import 'package:flutter_svg/flutter_svg.dart';

class BroadcastItem extends StatelessWidget {
  const BroadcastItem({Key key, this.task, this.show}) : super(key: key);
  final BroadcaseTaskModel task;
  final bool show;

  @override
  Widget build(BuildContext context) => Container(
        width: double.infinity,
        child: Row(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            Expanded(
              flex: 1,
              child: Padding(
                padding: const EdgeInsets.symmetric(vertical: 10),
                child: Column(
                  children: [
                    Text(
                      task.time,
                      style: TextStyle(
                        color: gColor("#08D187"),
                        fontSize: 16,
                      ),
                    ),
                    SvgPicture.asset(
                      "assets/icon/line.svg",
                      color: gColor("#08D187"),
                    )
                  ],
                ),
              ),
            ),
            Expanded(
              flex: 6,
              child: ListTile(
                isThreeLine: false,
                minVerticalPadding: 0,
                minLeadingWidth: 34,
                leading: Container(
                  width: 45,
                  height: 45,
                  decoration: BoxDecoration(
                    color: Color(0xffEDD4F5),
                    borderRadius: BorderRadius.circular(10),
                  ),
                  child: ClipRRect(
                      borderRadius: BorderRadius.circular(10),
                      child: Image.network(
                        task.cover,
                        fit: BoxFit.cover,
                      )),
                ),
                title: Text(
                  task.taskname,
                  overflow: TextOverflow.ellipsis,
                  style: TextStyle(
                    color: Colors.black,
                    fontSize: 18,
                  ),
                ),
                subtitle: Row(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    SvgPicture.asset(
                      "assets/icon/music_icon.svg",
                      color: gColor("#08D187"),
                    ),
                    SizedBox(width: 8),
                    Container(
                      width: 100,
                      child: Text(
                        task.filename,
                        maxLines: 2,
                        overflow: TextOverflow.ellipsis,
                        style: TextStyle(
                          color: gColor('#888888'),
                          fontSize: 14,
                        ),
                      ),
                    ),
                  ],
                ),
                trailing: show
                    ? Container(
                        width: 25,
                        height: 25,
                        child: SvgPicture.asset(
                          "assets/icon/music_playing.svg",
                          color: gColor("#08D187"),
                        ),
                      )
                    : SizedBox(),
              ),
            ),
            // Expanded(flex: 5, child: Placeholder()),
          ],
        ),
      );
}
